package model.DAO;

import java.util.HashMap;
import java.util.List;
import java.util.Map;
import model.Entity.SIS.Timetable;
import org.springframework.stereotype.Repository;

@Repository("TimetableDAO")
public class TimetableDAO extends GenericDAO {
		
	public List<Timetable> findAll(){
		return super.findAll(Timetable.class);
	}
	
	public List<Timetable> findByFaculty(Integer facultyNo){
		Map<String, Integer> paramMap = new HashMap<String, Integer>();
		//Query q = super.getEntityManager().createNamedQuery("findByFaculty");
		//q.setHint(hintName, value)
		paramMap.put("facultyNo", facultyNo);
		return super.findByNamedQuery(Timetable.class, "findByFaculty", paramMap);
	}
	
	public List<Timetable> findByFacultyAndDept(Integer facultyNo, Integer debtCode){
		Map<String, Integer> paramMap = new HashMap<String, Integer>();
		paramMap.put("facultyNo", facultyNo);
		paramMap.put("debtCode", debtCode);
		return super.findByNamedQuery(Timetable.class, "findByFacultyAndDept", paramMap);
	}

}
